#ifndef APPOINDMENT_H
#define APPOINDMENT_H

#include <string>
#include <iostream>

using namespace std;

 
enum Day {Sunday=1,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday};

Day intToDay(int n) throw (int);

int dayToInt(Day d);

class Time
{
private: 
	
	int hour;
	int minutes;

public:

	Time(int,int);
	int getHour() const;
	int getMinutes() const;
	bool operator<(Time const & other) const;
	bool operator>(Time const & other) const;
	bool operator<=(Time const & other) const;
	bool operator>=(Time const & other) const;
	bool operator==(Time const & other) const;
	bool operator!=(Time const & other) const;
};

class Appointment
{

protected:
	Time startTime;
	Time endTime;
	string subject;
	Day day;


public:

	Appointment(Time const & start,Time const & end,Day const & day, string const & subject = "N/A");

	virtual ~Appointment();

	Time getStartTime() const;

	Time getEndTime() const;

	string getSubject() const;

	Day getDay() const;

	static bool compare(Appointment const * a, Appointment const * b) ;

	/*	
		< returns true iff intersects or predates with other
		> returns true iff intersects or postdates the other
		== returns true iff the two appointmaents intersect in time and day.
		etc...
		only operator< is virtual to allow inheritance (the others derive from it).
	*/
	virtual bool operator<(Appointment const & other) const; 
	bool operator>(Appointment const & other) const;
	bool operator<=(Appointment const & other) const;
	bool operator>=(Appointment const & other) const;
	bool operator!=(Appointment const & other) const;
	bool operator==(Appointment const & other) const;
};

bool compare(Appointment const * a, Appointment const * b);

ostream& operator<<(ostream& os,Time const & t);

ostream& operator<<(ostream& os,Appointment const & t);

ostream& operator<<(ostream& os,Day const & t);


#endif